%define commit 705c5f455a5752b1a1954354218cde7d31f66198
%define commit_short %(echo %{commit} | head -c6)
%define dont_relink 1

Summary(ru_RU.UTF-8):	Клиент магазина приложений для МОС
Summary:	Applications store client MOS
Name:		mos-appstore
Version:	1.0
Release:	3.git%{commit_short}.3
License:	GPL
Group:		System/Configuration/Packaging
Url:		https://os.mos.ru/
Vendor:		MOS
Source0:	https://hub.mos.ru/mos/src/uds-agent2/appstore.client.app/-/archive/%{commit}/appstore.client.app-%{commit}.tar.gz
Source1:	ru.mos.os.mos-appstore.policy

BuildRequires: qt5-macros
BuildRequires: desktop-file-utils
BuildRequires: gcc-c++
BuildRequires: pkgconfig(libcurl)
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5Gui)
BuildRequires: pkgconfig(Qt5Network)
BuildRequires: pkgconfig(Qt5WebChannel)
BuildRequires: pkgconfig(Qt5WebSockets)
BuildRequires: pkgconfig(Qt5Quick)
BuildRequires: pkgconfig(polkit-qt5-1)
BuildRequires: pkgconfig(sdbus-c++)
Requires:	mos-appstore-service
Requires:	polkit
Conflicts:	mos-std < 5.10

%description
%summary.

%description -l ru_RU.UTF-8
Клиентское приложение для магазина приложений МОС.

%files
%{_bindir}/%{name}
%{_sysconfdir}/appstoreclientapp.conf
%{_iconsdir}/hicolor/scalable/apps/%{name}.svg
%{_datadir}/applications/%{name}.desktop
%{_datadir}/polkit-1/actions/ru.mos.os.mos-appstore.policy
"%{_sysconfdir}/skel/Рабочий стол/%{name}.desktop"

#------------------------------------------------------------------

%prep
%autosetup -p1 -n appstore.client.app-%{commit}
cp %{SOURCE1} .

%build
%qmake_qt5 appstoreclientapp.pro
%make_build

%install
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_sysconfdir}
mkdir -p %{buildroot}%{_iconsdir}/hicolor/scalable/apps
mkdir -p %{buildroot}%{_datadir}/applications
mkdir -p %{buildroot}%{_datadir}/polkit-1/actions
mkdir -p "%{buildroot}%{_sysconfdir}/skel/Рабочий стол"

install -m644 ru.mos.os.mos-appstore.policy %{buildroot}%{_datadir}/polkit-1/actions/
install -p -m755 %{name} %{buildroot}%{_bindir}
install -p -m755 appstoreclientapp.conf %{buildroot}%{_sysconfdir}
install -p -m644 %{name}.svg %{buildroot}%{_iconsdir}/hicolor/scalable/apps/%{name}.svg
desktop-file-install %{name}.desktop
ln -sf %{_datadir}/applications/%{name}.desktop "%{buildroot}%{_sysconfdir}/skel/Рабочий стол/%{name}.desktop"
